package test.api.feign.api;

import feign.Logger;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @Author wangshaopeng
 * @Date 2020/11/8
 */
@FeignClient(name = "stock")
public interface FeignSayApi {

    @GetMapping("/say/{name}")
    String say(@PathVariable("name") String name);



     class SayConfig{

         @Bean
         RequestInterceptor interceptor(){
             return new RequestInterceptor() {
                 @Override
                 public void apply(RequestTemplate requestTemplate) {
                     System.out.println("say");

                 }
             };
         }

         @Bean
         feign.Logger.Level level(){
             System.out.println("say-full");
             return Logger.Level.FULL;
         }
    }
}
